﻿package com.sh.game.global
{
    import com.sh.game.consts.*;

    public class Config extends Object
    {
        public static var memoryLimit:int = 524288000;
        public static var memoryInterval:int = 10000;
        public static var gameParams:Object;
        public static var testCode:Boolean = false;
        public static var testZone:Boolean = true;
        public static var fps:int = 60;
        public static var frameUploadMax:int = 200000;
        public static var deliverFrameUploadMax:int = 300000;
        public static var clothSkinPath:String = "assets/models/roles/";
        public static var shadowPath:String = "assets/models/shadow/";
        public static var weaponSkinPath:String = "assets/models/arm/";
        public static var wingSkinPath:String = "assets/models/wing/";
        public static var monsterPath:String = "assets/models/monster/";
        public static var npcPath:String = "assets/models/npc/";
        public static var roleSkinPath:String = "assets/models/roles/";
        public static var bodySkinPath:String = "assets/images/effects/";
        public static var mapPath:String = "assets/images/maps/";
        public static var mapDataPath:String = "assets/data/map/";
        public static var NewBirdCity:int = 1001;
        public static var SkinExt:String = ".dat";
        public static var JPGExt:String = ".jpg";
        public static var autoCreate:Boolean = false;
        public static var debug:Boolean = true;
        public static const IconExtension:String = ".png";
        public static var hexie:Boolean = false;
        public static var swfHead:Array = [67, 87, 83, 11];
        public static var applyBlendMode:Boolean = false;
        public static var isRightMouse:Boolean = true;
        public static const LostContext:String = "Disposed";
        public static var isYaCe:Boolean = true;
        public static var versionUrl:String = "";
        public static var swfkey:String = "8aff474e62f692ad1002b591a4b59794";
        public static var mswfkey:String = "98dfvkjhriuytjojxcbvl";
        public static var defaultVersion:String = "";
        public static var resVersions:Object = new Object();
        public static var resDics:Object = new Object();
        public static var errors:Object = new Object();
        public static var BytesCacheMax:int = 3.14573e+007;
        public static var Encrypt:Boolean = false;
        public static var sellAll:Boolean = false;
        public static var Log:int = 0;

        public function Config()
        {
            return;
        }// end function

        public static function get resourceRoot() : String
        {
            var _loc_1:String = "";
            if (Config.gameParams && Config.gameParams.hasOwnProperty("imageserver"))
            {
                _loc_1 = Config.gameParams.imageserver;
            }
            return _loc_1;
        }// end function

        public static function get swfPath() : String
        {
            var _loc_1:String = "";
            if (Config.gameParams)
            {
                if (Config.gameParams.hasOwnProperty("pluginserver"))
                {
                    _loc_1 = Config.gameParams.pluginserver;
                }
                else if (Config.gameParams.hasOwnProperty("imageserver"))
                {
                    _loc_1 = Config.gameParams.imageserver;
                }
            }
            return _loc_1;
        }// end function

        public static function get dataPath() : String
        {
            var _loc_1:String = "";
            if (Config.gameParams)
            {
                if (Config.gameParams.hasOwnProperty("configserver"))
                {
                    _loc_1 = Config.gameParams.configserver;
                }
                else if (Config.gameParams.hasOwnProperty("imageserver"))
                {
                    _loc_1 = Config.gameParams.imageserver;
                }
            }
            return _loc_1;
        }// end function

        public static function getUrl(param1:String, param2:int = 1, param3:String = null, param4:String = null) : String
        {
            var _loc_5:String = null;
            switch(param2)
            {
                case ResourceType.NORMAL:
                {
                    if (param1 in resVersions)
                    {
                        _loc_5 = "?version=" + resVersions[param1];
                    }
                    else
                    {
                        _loc_5 = "?version=" + Config.defaultVersion;
                    }
                    param1 = Config.resourceRoot + param1 + _loc_5;
                    break;
                }
                case ResourceType.DATA:
                {
                    _loc_5 = Config.versionUrl;
                    param1 = Config.dataPath + param1 + _loc_5;
                    break;
                }
                case ResourceType.SWF:
                {
                    _loc_5 = Config.versionUrl;
                    param1 = Config.swfPath + param1 + _loc_5;
                    break;
                }
                case ResourceType.MAP:
                {
                    if (param3 in resVersions)
                    {
                        _loc_5 = "?version=" + resVersions[param3];
                    }
                    else
                    {
                        _loc_5 = "?version=" + Config.defaultVersion;
                    }
                    param1 = Config.resourceRoot + param1 + _loc_5;
                    break;
                }
                case ResourceType.MODEL:
                {
                    if (param3 in resVersions)
                    {
                        _loc_5 = "?version=" + resVersions[param3];
                    }
                    else
                    {
                        _loc_5 = "?version=" + Config.defaultVersion;
                    }
                    param1 = Config.resourceRoot + param1 + _loc_5;
                    break;
                }
                default:
                {
                    param1 = param1 + Config.versionUrl;
                    break;
                    break;
                }
            }
            return param1;
        }// end function

    }
}
